package sys.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/redis")
@Slf4j
@Api(tags = "redis测试")
public class RedisController {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;
    @Autowired
    private RedisTemplate redisTemplate;



    @RequestMapping("/add")
   public void add(){
        //String类型的数据
      //  stringRedisTemplate.opsForValue().set("oa","123");
        redisTemplate.opsForList().leftPush("studentId",1);
        redisTemplate.opsForList().leftPush("studentId",2);
        Integer studentId = (Integer) redisTemplate.opsForList().rightPop("studentId");
        log.info("studentId:{}",studentId);


    }



}
